﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Flame.Controls
{
    class ButtonThread : Button
    {
        Thread _thread;

        public ButtonThread()
        {
        }
        public void Start(Action a)
        {
            Stop();
            _thread = new Thread(new ThreadStart(() => { a(); }));
        }
        public void Stop()
        {
            if (_thread.IsAlive) _thread.Abort();
        }
        public void Pause()
        {
            //_thread.S
        }
        public void Resume()
        {
        }
        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);
            Stop();
        } 

    }
}
